<!--<template>
-->
<!--    <div>证据</div>-->
<!--</template>-->
<template>
  <div class="content-center">
    <div class="content-cotainer border-box">
      <div class="content-breadcrumb">
        <el-breadcrumb separator="/" class="breadcrumb">
          <el-breadcrumb-item :to="{ path: '/' }">审计分析</el-breadcrumb-item>
          <el-breadcrumb-item>审计证据</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
      <div class="audit-content">
        <div class="centent-title">
          <span style="font-size: medium ">{{title}}</span>
        </div>
        <div class="centent-inner" style="padding:15px;">
          <div>
            <el-button type="primary" size="small" icon="el-icon-receiving" @click="addEvidence()">保存</el-button>
            <!-- <el-button type="success" size="small" icon="el-icon-link">取证单</el-button> -->

          </div>
          <div style="margin-top: 10px;margin-left:10px">
            <el-form :inline="true" :model="formInline" class="demo-fornline">
              <div>
                <el-form-item label="审计证据名称" prop="auditPrfNm">
                  <el-input size="small" v-model="formInline.auditPrfNm" placeholder="审计证据名称"></el-input>
                </el-form-item>
                <el-form-item label="编制人" style="margin-left: 55px" prop="writerNm">
                  <el-select v-model="formInline.writerNm" size="small" placeholder="编制人">
                    <el-option label="张剑阁" value="shanghai"></el-option>
                    <el-option label="邹阳" value="beijing"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="编制日期" style="margin-left: 85px" prop="createDt">
                <div class="block">
                <el-date-picker
                  v-model="formInline.createDt"
                  type="date"
                  placeholder="选择日期">
                </el-date-picker>
              </div>
              </el-form-item>
              </div>
              <div style="margin-top: -20px">
                <el-form-item label="审计证据概述" prop="prfDesc">
                  <el-input size="small" v-model="formInline.prfDesc" style="width: 590px;" placeholder="审计证据概述"></el-input>
                </el-form-item>
              </div>
            </el-form>
          </div>
          <div style="margin-left:10px">
            <el-button size="small" v-show="butt">下载附件</el-button>
            <el-button size="small">从资料引入附件</el-button>
            <el-button size="small">上传附件</el-button>
            <el-button size="small">编辑附件</el-button>
            <!-- <el-button size="small">删除附件</el-button> -->
          </div>
          <div>
            <el-table :data="tableData" stripe style="width: 100%">
              <el-table-column type="selection" width="55" />
              <el-table-column prop="date" label="附件名称">
              </el-table-column>
              <el-table-column prop="name" label="附件类型">
              </el-table-column>
              <el-table-column prop="address" label="编制人">
              </el-table-column>
              <el-table-column prop="address" label="编制日期">
              </el-table-column>
              <el-table-column prop="address" label="审计人员">
              </el-table-column>
              <el-table-column prop="address" label="附件">
              </el-table-column>
            </el-table>
            <el-pagination style="margin-top: 10px;" v-show="total>0" :current-page="1" :page-sizes="[10,20,30, 50]" :page-size="10" :total="total" background layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
          </div>
        </div>

      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios"
import qs from 'qs'
export default {
  data() {
    return {
      tableData: [{
        date: '2016-05-01',
        address: '暂无',
        name: '张剑阁'
      }],
      formInline: {
       
      },
      total: 3,
      title: '新增审计证据',
      butt : false
    }
  },
  methods: {
    addEvidence() {
        let params = {
         auditPrfNm : this.formInline.auditPrfNm,
         prfDesc : this.formInline.prfDesc,
         writerNm : this.formInline.writerNm,
         nodeId :1,
         writerId :1,
         auditGrpId :1,
         auditPrjId:1,
         rcrdCrtpsnId :1,
         rcrdCrtpsnNm : 2,
         auditPrfId: '',
         lcsCd : 1
        }
        if (this.$route.query.id) {   
          params.auditPrfId =this.$route.query.id
          console.log(params)
         axios.post('http://128.16.181.100:7111/evidence/updateEvidence', params).then((response) => {
        console.log(response)
        this.tableData = response.data.data
        this.$router.push({name:'auditEvidence'})
      }).catch((response) => {
        console.log(response)
      })
        } else {
          //add
          // params.auditPrfId : this.$route.query.id
       axios.post('http://128.16.181.100:7111/evidence/insertEvidence', params).then((response) => {
        console.log(response)
        this.tableData = response.data.data
         this.$router.push({name:'auditEvidence'})
      }).catch((response) => {
        console.log(response)
      })
        }
    },
    
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },

  },mounted() {
    console.log('0000000')
    if (this.$route.query.id) {
      console.log('修改审计证据')
      this.title = '修改审计证据'
      this.butt = 'true'
       axios.post('http://128.16.181.100:7111/evidence/cheackEvidence',{auditPrfId: this.$route.query.id}).then((response) => {
        console.log(response)
        this.formInline = response.data
      }).catch((response) => {
        console.log(response)
      })

    }
    


  }
}
</script>

<style lang="less" scoped>
.el-table th,
.el-table tr {
  background-color: transparent;
}

.content-cotainer {
  padding: 0 20px 20px 20px;
  height: 100%;
}
</style>
